<?php
/*
#####################################
#  ShopOS: Shopping Cart Software.
#  
#  
#  http://shopos3.com
#  Ver. 1.0.0
#####################################
*/

function os_show_category($counter) 
{
    global $foo, $categories_string, $id;


    // image for first level
//    $img_1='<img src="themes/'.CURRENT_TEMPLATE.'/img/icon_arrow.jpg" alt="" />&nbsp;';


    for ($a=0; $a<$foo[$counter]['level']; $a++) {

      if ($foo[$counter]['level']=='1') {
      $categories_string .= "";
      }

      $categories_string .= "";

    }
    if ($foo[$counter]['level']=='') {
    if (strlen($categories_string)=='0') {
    $categories_string .='<ul class="categories">';
    } else {
    $categories_string .='</li></ul><ul class="categories">';
    }

//    $categories_string .= $img_1;
    $categories_string .= '<li class="bg_list"><b><a href="';
    } else {
    $categories_string .= '<li class="bg_list_un"> <a href="';
    }

	$cPath_new=os_category_link($counter,$foo[$counter]['name']);
  
    $categories_string .= os_href_link(FILENAME_DEFAULT, $cPath_new);
    $categories_string .= '">';

    if ( ($id) && (in_array($counter, $id)) ) {
      $categories_string .= '<b>&raquo; ';
    }

    // display category name
    $categories_string .= $foo[$counter]['name'];

    if ( ($id) && (in_array($counter, $id)) ) {
      $categories_string .= '</b>';
    }

	 
	if (SHOW_COUNTS == 'true') 
	{
      $products_in_category = os_count_products_in_category($counter);
	  
      if ($products_in_category > 0) 
	  {
        $col = '&nbsp;(' . $products_in_category . ')';
      }
    }
	
    if ($foo[$counter]['level']=='') 
	{
         $categories_string .= $col.'</a>'.'</b>';
    } 
	else 
	{
         $categories_string .= $col.'</a>';
    }

 

    $categories_string .= '';

    if ($foo[$counter]['next_id']) {
        os_show_category($foo[$counter]['next_id']);
    } else {
        $categories_string .= '</li></ul>';
    }
  }

?>